]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - Super Polarity/ActorManager.cs
Removes spaces.
[rbdr/super-polarity] / Super Polarity / ActorManager.cs
diff --git a/Super Polarity/ActorManager.cs b/Super Polarity/ActorManager.cs
deleted file mode 100644 (file)
index 1b4ef96..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-
-namespace SuperPolarity
-{
-    static class ActorManager
-    {
-
-        static Game Game;
-        static int OutlierBounds;
-        static List<Actor> Actors;
-
-        static ActorManager()
-        {
-            OutlierBounds = 100;
-            Actors = new List<Actor>();
-        }
-
-        static public void CheckIn(Actor actor)
-        {
-            Actors.Add(actor);
-        }
-
-        static public void CheckOut(Actor actor)
-        {
-            Actors.Remove(actor);
-        }
-
-        static public void Update(GameTime gameTime) 
-        {
-            CheckActors();
-            CheckOutliers();
-            foreach (Actor actor in Actors)
-            {
-                actor.Update(gameTime);
-            }
-        }
-
-        static public void Draw(SpriteBatch spriteBatch)
-        {
-            foreach (Actor actor in Actors)
-            {
-                actor.Draw(spriteBatch);
-            }
-        }
-
-        static void CheckActors()
-        {
-            var i = 0;
-            foreach (Actor actor in Actors)
-            {
-                i++;
-                foreach (Actor other in Actors.Skip(i))
-                {
-                    CheckCollision(actor, other);
-
-                    if (actor.GetType().IsSubclassOf(typeof(Ship)) && other.GetType().IsSubclassOf(typeof(Ship)))
-                    {
-                        CheckMagnetism((Ship)actor, (Ship)other);
-                    }
-                }
-            }
-        }
-
-        static void CheckCollision(Actor actor, Actor other)
-        {
-
-        }
-
-        static void CheckMagnetism(Ship actor, Ship other)
-        {
-            if (actor.CurrentPolarity != Ship.Polarity.Neutral && other.CurrentPolarity != Ship.Polarity.Neutral)
-            {
-                var dy = other.Position.Y - actor.Position.Y;
-                var dx = other.Position.X - actor.Position.X;
-                var linearDistance = Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2));
-                var angle = (float) Math.Atan2(dy, dx);
-                var otherAngle = (float)Math.Atan2(-dy, -dx);
-
-                if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius)
-                {
-                    actor.Magnetize(other, (float)linearDistance, angle);
-                    other.Magnetize(actor, (float)linearDistance, otherAngle);
-                }
-            }
-        }
-
-        static void CheckOutliers()
-        {
-            for (var i = Actors.Count; i > 0; i--)
-            {
-                var actor = Actors[i-1];
-                if (actor.Position.X < -OutlierBounds || actor.Position.Y < -OutlierBounds ||
-                    actor.Position.X > Game.GraphicsDevice.Viewport.Width + OutlierBounds ||
-                    actor.Position.Y > Game.GraphicsDevice.Viewport.Height + OutlierBounds)
-                {
-                    CheckOut(actor);
-                }
-            }
-        }
-
-        internal static void SetGame(Game game)
-        {
-            Game = game;
-        }
-    }
-}